package cn.yi.medicalsys.service.impl;

import java.util.ArrayList;
import java.util.List;

import cn.yi.medicalsys.dao.OfficeDao;
import cn.yi.medicalsys.dao.impl.OfficeDaoImpl;
import cn.yi.medicalsys.pojo.Office;
import cn.yi.medicalsys.service.OfficeService;

public class OfficeServiceImpl implements OfficeService {
	OfficeDao office=new OfficeDaoImpl();

	@Override
	public Office findOfficeByNo(Integer officeNo) {
		Office offic=null;//定义科室对象
		try {
			offic=office.findOfficeByNo(officeNo);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return offic;
	}

	@Override
	public List<Office> findAllOffice() {
		List<Office> list=new ArrayList<Office>();
		try {
			list=office.findAllOffice();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}

	@Override
	public boolean updateOfficeByName(Integer officeNo,String offficeName){
		int row=-1;
		try {
			row = office.updateOfficeByName(officeNo,offficeName);
		} catch (Exception e) {
			e.printStackTrace();
		}
		if(row==1){
			return true;
		}
		return false;
	}

}
